<template>
  <div id="app">
    <el-dialog :visible.sync="aduitDialog" center title="审核信息" top="20px">
      <div style="position: absolute;top: 25px;right: 60px">
        <img v-if="info.state==1" src="@/assets/img/pass.svg" class="warehouse_icon" />
        <img v-if="info.state==2" src="@/assets/img/reject.svg" class="warehouse_icon" />
        <img v-if="info.state==0" src="@/assets/img/pedding.svg" class="warehouse_icon" />
      </div>
      <div style="max-height: 700px;overflow: scroll">
        <div style="font-weight: 600;margin-bottom: 10px">基本信息：</div>
        <el-descriptions class="margin-top" :column="3" border>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-user"></i>
              用户名
            </template>
            {{ info.userName }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-user"></i>
              性别
            </template>
            {{ info.sex }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-info"></i>
              年龄
            </template>
            {{ info.age }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-phone"></i>
              手机号
            </template>
            {{ info.phoneNumber }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-office-building"></i>
              联系地址
            </template>
            {{ info.address }}
          </el-descriptions-item>
        </el-descriptions>
        <el-descriptions class="margin-top" :column="3" border>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-user"></i>
              岗位
            </template>
            {{ info.roleName }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-tickets"></i>
              工作年限
            </template>
            {{ info.workYears + '年' }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-mobile-phone"></i>
              微信号
            </template>
            {{ info.wechatId }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-tickets"></i>
              身份证号
            </template>
            {{ info.idCard }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-office-building"></i>
              个人介绍
            </template>
            {{ info.introduction || '暂无介绍' }}
          </el-descriptions-item>
        </el-descriptions>
        <el-descriptions class="margin-top" :column="3" border>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-postcard"></i>
              身份证正面
            </template>
            <el-image
                style="width: 100px; height: 100px"
                :src="'https://'+info.frontImg"
                :preview-src-list="['https://'+info.frontImg]"></el-image>
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-postcard"></i>
              身份证正面
            </template>
            <el-image
                style="width: 100px; height: 100px"
                :src="'https://'+info.backImg"
                :preview-src-list="['https://'+info.backImg]"></el-image>
          </el-descriptions-item>
        </el-descriptions>
        <el-descriptions class="margin-top" :column="3" border>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-postcard"></i>
              技能证书
            </template>
            <el-image
                style="width: 100px; height: 100px"
                v-for="item in info.certificateImg"
                :key="item"
                :src="'https://'+item"
                :preview-src-list="['https://'+item]"></el-image>
          </el-descriptions-item>
        </el-descriptions>
        <div style="margin-top: 20px;font-weight: 600;margin-bottom: 15px">项目经历：</div>
        <el-timeline>
          <el-timeline-item :timestamp="item.startTime+'至'+item.endTime" placement="top"
                            v-for="(item,index) in info.projectDetail" :key="index">
            <el-card>
              <h4>{{ item.projectName }}</h4>
              <p style="margin-top: 10px">{{ item.content }}</p>
            </el-card>
          </el-timeline-item>
        </el-timeline>
      </div>
      <span slot="footer" v-if="info.state==0">
        <el-button style="color: #FFFFFF" @click="pass">通 过</el-button>
        <el-button style="background-color:#F78989;color: #FFFFFF" @click="rejectDialog=true">驳 回</el-button>
      </span>
    </el-dialog>
    <el-dialog :visible.sync="rejectDialog" append-to-body center width="25%" title='驳回理由'>
     <div style="display: flex;align-items: center;justify-content: center"> <el-input v-model="rejectReason" type="textarea"></el-input></div>
      <span slot="footer">
        <el-button style="background-color:#F78989;color: #FFFFFF" @click="reject">确认驳回</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: "aduitTalent",
  data() {
    return {
      aduitDialog: false,
      rejectDialog: false,
      rejectReason:"",
      info: {}
    }
  },
  methods: {
    handleOpen(val) {
      this.info = val
      // console.log(this.info)
      this.aduitDialog = true
    },
    pass() {
      const data = {
        state: 1,
        userId: this.info.userId
      }
      this.$api.talentApproveTalentInfo(data).then(res => {
        this.aduitDialog = false
        this.$message.success("审核成功！")
        this.$emit('addStatus', 1);
      })
    },
    reject(){
      const data = {
        state: 2,
        userId: this.info.userId,
        rejectReason:this.rejectReason
      }
      this.$api.talentApproveTalentInfo(data).then(res => {
        this.aduitDialog = false
        this.rejectDialog=false
        this.$message.success("已驳回！")
        this.$emit('addStatus', 1);
      })
    }
  }
}
</script>

<style scoped>
.warehouse_icon{
  width: 100px;
}
</style>